package com.kingyea.app.market.client;

import com.kingyea.app.market.condition.AllCondition;
import com.kingyea.app.market.dept.bean.Organization;
import com.kingyea.app.market.dept.bean.OrganizationVo;
import com.kingyea.app.market.utils.BasePage;
import com.kingyea.mobilepolice.system.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "auth-server")
public interface OrganizationServiceClient {

    /**
     * 不需要分页
     *
     * @param map
     * @return
     */
    @RequestMapping(value = "/organization/search", method = RequestMethod.POST)
    List<Organization> list(Map<String, Object> map);

    /**
     * @param map
     * @return
     */
    @RequestMapping(value = "/organization/parentDeptList", method = RequestMethod.POST)
    List<Organization> parentDeptList();

    /**
     * 加载授权树
     *
     * @param map
     * @return
     */
    @RequestMapping(value = "/organization/authTree", method = RequestMethod.POST)
    public Object authTree(Map<String, Object> map);

    @RequestMapping(value = "/organization/deptTree", method = RequestMethod.POST)
    public List<Organization> deptTree(Map<String, Object> map);

    /**
     * 加载所有部门和子部门
     *
     * @param condition
     * @return
     */
    @RequestMapping(value = "/organization/tree", method = RequestMethod.POST)
    public Result<List<OrganizationVo>> tree(Map<String, Object> condition);

    @RequestMapping(value = "/organization/tree", method = RequestMethod.POST)
    public Object tree2(Map<String, Object> condition);

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    Object test();

    @RequestMapping(value = "/organization/authDeptList", method = RequestMethod.POST)
    public Result<BasePage<Organization>> authDept(Map<String, Object> condition);

    @RequestMapping(value = "/organization/getBySerialNo", method = RequestMethod.POST)
    public Result<Organization> getBySerialNo(@RequestParam(value = "serialNo") String serialNo) throws Exception;

    @RequestMapping(value = "/organization/getByUserId", method = RequestMethod.POST)
    Object getByUserId(@RequestBody AllCondition condition) throws Exception;

}
